﻿@model VM_ChangePasswd
@{
	Layout = "_LayoutContent";
}

@section header{
}

<table cellspacing='0' cellpadding='5' border='0' class="small" style="width:100%;">
	<tr>
		<td class="detail-content-heading" colspan="2"><b>修改密码</b></td>
	</tr>
	<tr style="height: 28px">
		<td width='40%' class='detail-content-label' align='right'><b>旧密码：</b></td>
		<td width='60%' class='detail-content-info'>
			<input name='oldpasswd' type='password' maxlength='20' v-model="model.oldpasswd">
		</td>
	</tr>
	<tr style="height: 28px">
		<td class='detail-content-label' nowrap align="right"><b>新密码：</b></td>
		<td class='detail-content-info'>
			<input name='newpasswd' type='password' maxlength='20' v-model="model.newpasswd">
		</td>
	</tr>
	<tr style="height: 28px">
		<td class='detail-content-label' nowrap align="right"><b>确认密码：</b></td>
		<td class='detail-content-info'>
			<input name='newpasswd2' type='password' maxlength='20'>
		</td>
	</tr>
	<tr style="height: 50px">
		<td colspan="2" class='detail-content-info' style="text-align:center;">
			<button class="pure-button pure-button-success" title="保存 [Alt+S]" @@click.prevent="changePasswd" style="font-size:12px;">
				<i class="icon-check"></i>修改
			</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<button class="pure-button pure-button-cancel" title="关闭" onclick="closeWnd();return false;" style="font-size:12px;">
				<i class="icon-off"></i>取消
			</button>&nbsp;
		</td>
	</tr>
</table>
<br>

@section footer{

	<script type="text/javascript">
		var modelJson=@(Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model,new Newtonsoft.Json.JsonSerializerSettings()
				   {
				   DateFormatString = "yyyy-MM-dd HH:mm:ss"
					})));
		var modelData = $.extend(modelJson, {
		});
		var pageData = {
			hideBreadcrumb: false,
			global: globalData,
			model: modelData,
		};

		var pageApp = new Vue({
			el: '#app',
			data: pageData,
			mounted: function () {
			},
			methods: {
				changePasswd: function (item) {
					var _this = this;
					utils.ajaxPost('@(Url.Action("ChangePasswd","Sys_User"))', _this.model, function (resp) {
						parent.utils && parent.utils.success && parent.utils.success("密码修改成功");
						closeWnd();
					}, function (msg) {
						utils.alert(msg);
					});
				}
			},
			computed: {
			},
			filters: {
			}
		});

		function closeWnd() {
			var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
			parent.layer.close(index);
		}
	</script>
}